import api from "../utils/api";
import { APP, PAGE, FORMEDITRIGHT } from "../constants/api";

const _api = api(APP);
const pageApi = api(PAGE);
const fromApi = api(FORMEDITRIGHT);

export default {
  getApps: (data) => _api('list', { params: data }),
  getBoard: appid => _api('getBoardInfoWithApp', { params: { appid } }),
  getDatas: (dataKey) => _api('getDatas', { params: { dataKey }, method: 'post' }),
  getLeftDatas: () => _api('getLeftDatas'),
  getSubmitCount: (appid) => _api('form/submittedCount', { params : { appid }}),
  getSubmitAuthInfo: (appid) => _api('form/submitAuthInfo', { params: { appid } }),
  submitAuthChange: (data) => _api('form/submitAuthChange', { method: 'post', params: data }),
  addSubmitMember: (data) => _api('form/submitMemberAdd', { method: 'post', params: data }),
  delSubmitMember: (data) => _api('form/submitMemberDel', { method: 'post', params: data }),
  getCountInfo: (data) => _api('form/countInfo', { params: data }),
  getSubmittedInfo: (data) => _api('form/submittedInfo', { params: data }),
  getCountInfoEachDay: (data) => _api('form/countInfoEachDay', { params: data }),
  fillinEnable: (data) => _api('form/fillinEnable', { params: data }),
  getMemberRecentAdd: (appid) => _api('form/memberRecentAdd', { params: { appid } }),
  getUnSubmitUserInfo: (appid, date) => _api('form/unSubmitUserInfo', { params: { appid, date }}),
  getBaseInfo: (appid) => _api('form/baseInfo', { params: { appid }}),
  getDesign: (appid) => pageApi('design', { params: { appid } }),
  addShareMembers: (data) => _api('form/share', { method: 'post', params: data }),
  getApplyInfo: (id) => fromApi('applyInfo', { params: { id } }),
  processApply: (data) => fromApi('processApply', { params: data }),
  getConversationInfo: (data) => _api('form/getConversationInfo', { params: data }),
  getExceptMembers: (data) => _api('form/getExceptMembers', { params: data }),
  modifyExceptMembers: (data) => _api('form/modifyExceptMembers', { method: 'post', params: data }),
  shareList: (appid) => _api('shareList', {params: { appid }}),
  deleteShare: (data) => _api('deleteShare', {method: 'post', params: data}),
  fillinRemind: (data) => _api('form/fillinRemind', { method: 'post', params: data}),
  addShareData: (data) => _api('share', { method: 'post', params: data }),
  info: (appid) => _api('info', { params: {appid} }),
  getSetInfo: (appid) => pageApi('setting/info', { params: { appid }, ignoreError: true}),
  statisticsMembers: (data) => _api('form/statisticsMembers', {params: data}),
  listFilledHistory: (data) => _api('listFilledHistory', { params: data }),
  listToBeFilled: (data) => _api('listToBeFilled', { params: data })
};